package com.example.qgorderprovider.controller;

import com.example.qgorderprovider.server.OrderService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;

@RestController
public class OrderController {

    @Resource
    private OrderService service;

    @RequestMapping("/addOrder")
    public int addOrder(@RequestParam Map map){
        //获得stockId
        System.out.println("map:"+map);
         return service.AddOrder(map);

    }

    @RequestMapping("/getOrdersByUid")
    public List<Map> getOrdersByUid(@RequestParam("userId") int userId){
        return service.getOrdersByUid(userId);
    }
    @RequestMapping("/getById")
    public Map getById(@RequestParam("id") String id){
        return service.getById( id );
    }
    @RequestMapping("/updateStatus")
    public int updateStatus(@RequestParam Map map) {
        System.out.println("map:"+map);
        return service.updateStatus(map);
    }
}
